package com.ruoyi.review.service.impl;

import com.ruoyi.review.domain.ReviewContent;
import com.ruoyi.review.mapper.ReviewContentMapper;
import com.ruoyi.review.service.IReviewContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Classname IReviewContentServiceImpl
 * @Description
 * @Date 2025/5/25 16:37
 * @Created by 孟祥宇
 */
@Service
public class IReviewContentServiceImpl implements IReviewContentService {

    @Autowired
    private ReviewContentMapper reviewContentMapper;
    @Override
    public void addReviewContent(ReviewContent reviewContent) {

        reviewContentMapper.insert(reviewContent);
    }

    @Override
    public void deleteReviewContent(Long id) {
        reviewContentMapper.deleteById(String.valueOf(id));
    }

    @Override
    public void updateReviewContent(ReviewContent reviewContent) {
        reviewContentMapper.deleteById(String.valueOf(reviewContent.getId()));
        reviewContentMapper.save(reviewContent);
    }

    @Override
    public List<ReviewContent> list(ReviewContent reviewContent) {
        return reviewContentMapper.findAll();
    }

    @Override
    public ReviewContent getById(Long id) {
        return reviewContentMapper.findById(String.valueOf(id)).get();
    }
}
